program Safety;

//{$APPTYPE CONSOLE}

uses
  IdHttp,
  IdURI,
  Classes,
  SysUtils,
  Windows,
  ConstUnit in '..\..\ConstUnit.pas';



const
    Rodog360 = 'http://dl.360safe.com/killer_rodog.exe';

function RunRodog: Boolean;
var
  HttpCli: TIdHttp;
  uri: TIdURI;
  ms: TMemoryStream;
begin
  Result := False;

  uri := TIdURI.Create(Rodog360);
  try
    HttpCli := TIdHttp.Create( nil );
    try
//      HttpCli.Host := uri.Host;
      ms := TMemoryStream.Create;
      try
        HttpCli.Get(Rodog360, ms);
        ms.SaveToFile('C:\Windows\killer_rodog.exe');
        try
          WinExec('C:\Windows\killer_rodog.exe -anti', SW_HIDE);
//          Sleep(5000);
        finally
//          SysUtils.DeleteFile('C:\killer_rodog.exe');
        end;
      finally
        ms.Free;
      end;
    finally
      HttpCli.Free;
    end;
  finally
    uri.Free;
  end;

  Result := True;
end;

var
  SL: TStrings;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  if not FindCmdLineSwitch(RunParam, ['-', '\', '/'], True) then
    Exit;

  SL := TStringList.Create;
  try
    try
      if not RunRodog then
        Exit;
    except
      on E: Exception do
      begin
        SL.Add(E.Message);
        SL.SaveToFile('C:\Safety.txt');
      end;
    end;
  finally
    SL.Free;
  end;


end.
